package com.yuyou.fn.tradingservice.service;

import com.github.wens.framework.service.ISuperService;
import com.github.wens.mybatisplus.plugins.Page;
import com.yuyou.fn.platform.entity.SysUser;
import com.yuyou.fn.tradingservice.entity.ServiceProduct;
import com.yuyou.fn.tradingservice.vo.*;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/**
 *
 * ServiceProduct 表数据服务层接口
 *
 */
public interface IServiceProductService extends ISuperService<ServiceProduct,Long> {

    ServiceLeaseProductDetail pullAllTimeStr(ServiceProduct serviceProduct);

    ServiceLeaseProductDetail leaseProductDetail(ServiceProduct serviceProduct);

    ServiceLeaseProductDetail leaseProductDetail(Long productId,Integer path);



    List<ServiceProduct> findByInventoryAndStatusAndType(Integer type,Integer inventory,Integer status);

    void offProduct(Long productId,Integer status);

    void saveOrUpdateGoods(ProductVo productVo, SysUser sysUser);

    void saveOrUpdateDemand(DemandVo demandVo,SysUser sysUser);

    void changeStatus(Long productId,Integer status);


    Long countServiceProductByCategoryId(Long categoryId);

    ServiceProduct findBySellerIdAndRoomId(Long sellerId,Long roomId);

    ServiceProduct findBySellerIdRoomIdProfitId(Long sellerId,Long roomId,Long profitMainAccountId);

    void checkIfRelease(Long sellerId,Long roomId,Long profitMainAccountId);

    Page<ServiceProduct> findProductPageByQueryVo(ProductQueryVo productQueryVo, int pageNo, int pageSize);


    Page<ServiceLeaseProductDetail> findLeaseProductByQueryVo(ProductQueryVo productQueryVo,int pageNo, int pageSize);

    List<ServiceProduct> findOrderByCreateTime(Integer status,Integer limit);

    void deleteProduct(Long categoryId);

    List<ServiceProduct> findProductsByCategoryId(Long categoryId);

    List<ServiceProduct> productDetail(Long categoryId);

    ServiceProduct findProductMaxAmountByType(Integer type);

    void deleteProductById(Long productId);

    /*path:0管理员操作，1卖家操作*/
    void deleteProductByUserIdAndProductId(Long userId,List<Long> productIds,Integer path);

    /*path:0管理员操作，1卖家操作, 2系统自动下架*/
    void onOrOff(SysUser user,Long productId,Integer status,Integer path);


    Map<Long,Object> findOwnPlaceList(SysUser sysUser);


    ServiceProduct saveLeaseProduct(LeaseVo leaseVo,SysUser sysUser, List<LeaseMessagePriceVo> leaseMessagePriceVoList);

    /*发布租赁查看时间占用表*/
    TreeMap<String,List<String>> findLeaseTimeTable(Date startDate,Date endDate,String startTime,String endTime,Long roomId,SysUser sysUser,Integer minutes,Long profitMainAccountId);

    /*
    租赁查看时间占用表
    * */
    TreeMap<String,List<String>> findPersonLeaseTimeTable(Date startDate, Date endDate, String startTime, String endTime, Long productId, Integer minutes);


    Boolean checkHaveRoom(SysUser sysUser,Long campusId,Long roomId);

    Boolean checkHaveAllRoomTime(Long profitMainAccountId,Long campusId);

    void updateCategoryNames(String oldCategoryName,String newCategoryName, Long  categoryId);

    void updateCategoryName(String categoryName,Long categoryId);
}